import request from '@/utils/request'

// 获取passTypeIdentifier信息列表
export function getPassTypeList(params) {
  return request({
    url: '/online/pass-generate/passTypeId/list',
    method: 'get',
    params
  })
}

// 删除passTypeIdentifier和证书
export function deletePassTypeIdentifier(params) {
  return request({
    url: '/online/pass-generate/passTypeId',
    method: 'delete',
    params
  })
}

// 新增证书
export function addPassTypeIdentifier(data) {
  return request({
    url: '/online/pass-generate/passTypeId',
    method: 'post',
    data
  })
}

//上传文件返回token
export function fileUpload(data, config, source) {
  return request({
    url: `/file-server/file/upload`,
    method: 'post',
    timeout: 10 * 60 * 1000,
    data: data,
    onUploadProgress: config.onUploadProgress,
    cancelToken: source.token
  })
}

// 获取NFC公钥信息列表
export function getNFCList(params) {
  return request({
    url: '/online/pass-generate/nfc/list',
    method: 'get',
    params
  })
}

// 删除NFC公钥信息
export function deleteNFC(params) {
  return request({
    url: '/online/pass-generate/nfc',
    method: 'delete',
    params
  })
}

// 新增NFC公钥信息
export function addNFC(data) {
  return request({
    url: '/online/pass-generate/nfc',
    method: 'post',
    data
  })
}

// 获取pass模板列表
export function getTemplateList(id, params) {
  return request({
    url: `/online/pass-generate/pass/${id}/list`,
    method: 'get',
    params
  })
}
